/**
 * 防抖装饰器
 * @param fn 执行函数
 * @param delay 间隔时间
 */
const Debounce = (fn: Function, delay: number)=>{
    let timer: any
    return function (this: any, ...args: any) {
        if (timer) {
            clearTimeout(timer)
        }
        timer = setTimeout(() => {
            fn.apply(this, ...args)
        }, delay)
    }
}

export default Debounce